<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <script>
        function Hero(name,type,blood){
             this.name = name;
             this.type = type;
             this.blood = blood;
             this.attack  = function(attack){
                 console.log(attack);
             }
        }
        var lp = new Hero('廉颇','边路','500血量');
        var hy = new Hero('后羿','射手','100血量');
        console.log(hy.blood);
        hy.attack('远程');
        console.log(lp.name);
        lp.attack('近战');
       
 
    </script>
</head>
<body>
    
</body>
</html>